﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using bi4homev3.Logica;

namespace bi4homev3
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["validar"] = "false";
            Session["mensaje"] = "nada";
            Session["ValidarCompra"] = "false";
        
        }
        
        protected void entrar_Click(object sender, EventArgs e)
        {
            int res = 0;
            Usuario usr = new Usuario();
            AccionesUsuario medio = new AccionesUsuario();
            usr.Login = this.user.Text;
            usr.Clave = this.psswd.Text;
            res = medio.chequeaLogin(usr);

            switch (res)
                {
                case 1:
                        
                        Session["usuario"] = usr.Login;
                        Session["validar"] = "true";
                        Response.Redirect("afterLogin.aspx");
                        break;
                default:
                        
                        Response.Redirect("Login.aspx");
                        break;
                }
        }
    }
}
